package okhttp;

import okhttp3.*;
import okio.BufferedSink;

import javax.annotation.Nullable;
import java.io.IOException;

public class Demo {
    public static void main(String[] args) throws IOException {
        OkHttpClient client = new OkHttpClient();


        HttpUrl httpUrl = HttpUrl.parse("https://api.douban.com/v2/book/1220562").newBuilder()
                .addQueryParameter("name", "telis")
                .build();
        Request request = new Request.Builder()
                .url(httpUrl).build();
        Response response = client.newCall(request).execute();
        if (!response.isSuccessful()) {
            System.out.println("错误");
        }
        System.out.println(response.body().string());

    }
}
